﻿{include file="common/header" /}
<!-- 中间区域 -->
<div class="grzx">
    <h1>在线支付</h1>

    <p>您需要支付￥<span>{$payAmount}</span> &nbsp;&nbsp;&nbsp;&nbsp;订单号：{$orderCn}</p>

    {$qrcode|raw}

    <ul>
        <li>
            <a >
                <img src="/public/home/images/asdabsdnm_14.jpg">
                <p>微信扫码支付</p>
            </a>
        </li>
    </ul>
</div>

<input type="hidden" name="out_trade_no" id="out_trade_no" value="{$orderCn}" />
{if $payId == 1}
<script>
    $(function(){
        setInterval(function(){check()}, 1000);  //1秒查询一次支付是否成功
    })
    function check(){
        var url = "/public/tools/wxpay/orderquery.php";　　//新建
        var out_trade_no = $("#out_trade_no").val();
        var param = {'out_trade_no':out_trade_no};
        $.post(url, param, function(data){
            data = JSON.parse(data);
            console.log(data);
            if(data['trade_state'] == "SUCCESS"){
                layer.msg("订单支付成功，即将跳转处理", {
                    icon: 6,
                    time: 2000 //2秒关闭（如果不配置，默认是3秒）
                }, function () {
                    //跳转页面
                    window.location.href = "/index/Flow/wxpay_return?time_end="+data['time_end']+"&total_fee="+data['total_fee']+"&out_trade_no="+data['out_trade_no']+"&transaction_id="+data['transaction_id'];
                });
            }else{
                console.log(data);
            }
        });
    }
</script>
{/if}
<!-- 中间区域结束 -->
{include file="common/footer" /}